using System;
using System.Linq;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Data;
using System.Data.Entity.ModelConfiguration;
using Widgetsphere.Autos.EFDAL.Entity;
using nHydrate.EFCore.Exceptions;

namespace Widgetsphere.Autos.EFDAL
{
	#region EntityMappingConstants Enumeration

	/// <summary>
	/// A map for all entity types in this library
	/// </summary>
	public enum EntityMappingConstants
	{
		/// <summary>
		/// A mapping for the the Administrator entity
		/// </summary>
		Administrator,
		/// <summary>
		/// A mapping for the the BodyType entity
		/// </summary>
		BodyType,
		/// <summary>
		/// A mapping for the the BulletPoint entity
		/// </summary>
		BulletPoint,
		/// <summary>
		/// A mapping for the the City entity
		/// </summary>
		City,
		/// <summary>
		/// A mapping for the the Color entity
		/// </summary>
		Color,
		/// <summary>
		/// A mapping for the the Condition entity
		/// </summary>
		Condition,
		/// <summary>
		/// A mapping for the the ConfigSetting entity
		/// </summary>
		ConfigSetting,
		/// <summary>
		/// A mapping for the the Dealer entity
		/// </summary>
		Dealer,
		/// <summary>
		/// A mapping for the the Feature entity
		/// </summary>
		Feature,
		/// <summary>
		/// A mapping for the the FuelType entity
		/// </summary>
		FuelType,
		/// <summary>
		/// A mapping for the the Listing entity
		/// </summary>
		Listing,
		/// <summary>
		/// A mapping for the the ListingImage entity
		/// </summary>
		ListingImage,
		/// <summary>
		/// A mapping for the the ListingPremium entity
		/// </summary>
		ListingPremium,
		/// <summary>
		/// A mapping for the the ListingSaved entity
		/// </summary>
		ListingSaved,
		/// <summary>
		/// A mapping for the the ListingView entity
		/// </summary>
		ListingView,
		/// <summary>
		/// A mapping for the the Make entity
		/// </summary>
		Make,
		/// <summary>
		/// A mapping for the the MakeModel entity
		/// </summary>
		MakeModel,
		/// <summary>
		/// A mapping for the the Metro entity
		/// </summary>
		Metro,
		/// <summary>
		/// A mapping for the the Model entity
		/// </summary>
		Model,
		/// <summary>
		/// A mapping for the the SearchSaved entity
		/// </summary>
		SearchSaved,
		/// <summary>
		/// A mapping for the the SearchSavedCriteria entity
		/// </summary>
		SearchSavedCriteria,
		/// <summary>
		/// A mapping for the the State entity
		/// </summary>
		State,
		/// <summary>
		/// A mapping for the the Transmission entity
		/// </summary>
		Transmission,
		/// <summary>
		/// A mapping for the the UserAccount entity
		/// </summary>
		UserAccount,
		/// <summary>
		/// A mapping for the the UserLoginHistory entity
		/// </summary>
		UserLoginHistory,
		/// <summary>
		/// A mapping for the the UserType entity
		/// </summary>
		UserType,
		/// <summary>
		/// A mapping for the the VistorContact entity
		/// </summary>
		VistorContact,
		/// <summary>
		/// A mapping for the the Zip entity
		/// </summary>
		Zip,
	}

	#endregion

	/// <summary/>
	public enum DatabasePlatformConstants
	{
		/// <summary/>
		SQLServer,
		/// <summary/>
		MySql,
	}

	#region Entity Context

	/// <summary>
	/// The object context for the schema tied to this generated model.
	/// </summary>
	[DataContract]
	[Serializable]
	public partial class AutosEntities : System.Data.Entity.DbContext, Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities, nHydrate.EFCore.DataAccess.IContext
	{
		/// <summary>
		/// The audit modifier used to mark database edits
		/// </summary>
		protected ContextStartup _contextStartup = new ContextStartup(null);

		#region Constructors

		/// <summary>
		/// Initializes a new AutosEntities object using the connection string found in the 'AutosEntities' section of the application configuration file.
		/// </summary>
		public AutosEntities() :
			base(Util.ConvertNormalCS2EFFromConfig("name=AutosEntities"))
		{
			this.CurrentPlatform = Util.GetDefinedPlatform();
			try
			{
				var builder = new System.Data.Odbc.OdbcConnectionStringBuilder(Util.StripEFCS2Normal(this.ObjectContext.Connection.ConnectionString));
				var timeoutValue = "30";
				if (builder.ContainsKey("connect timeout"))
					timeoutValue = (string) builder["connect timeout"];
				else if (builder.ContainsKey("connection timeout"))
					timeoutValue = (string) builder["connection timeout"];
				var v = Convert.ToInt32(timeoutValue);
				if (v > 0)
					this.CommandTimeout = v;
			}
			catch { }
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new AutosEntities object with an audit modifier.
		/// </summary>
		public AutosEntities(ContextStartup contextStartup) :
			base(Util.ConvertNormalCS2EFFromConfig("name=AutosEntities", contextStartup))
		{
			_contextStartup = contextStartup;
			this.CurrentPlatform = contextStartup.CurrentPlatform;
			this.ContextOptions.LazyLoadingEnabled = contextStartup.AllowLazyLoading;
			this.CommandTimeout = contextStartup.CommandTimeout;
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new AutosEntities object with an audit modifier.
		/// </summary>
		public AutosEntities(ContextStartup contextStartup, string connectionString) :
			base(Util.ConvertNormalCS2EF(connectionString, contextStartup))
		{
			_contextStartup = contextStartup;
			this.CurrentPlatform = contextStartup.CurrentPlatform;
			this.ContextOptions.LazyLoadingEnabled = contextStartup.AllowLazyLoading;
			this.CommandTimeout = contextStartup.CommandTimeout;
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new AutosEntities object.
		/// </summary>
		public AutosEntities(string connectionString) :
			base(Util.ConvertNormalCS2EF(connectionString))
		{
			this.CurrentPlatform = Util.GetDefinedPlatform();
			try
			{
				var builder = new System.Data.Odbc.OdbcConnectionStringBuilder(Util.StripEFCS2Normal(this.ObjectContext.Connection.ConnectionString));
				var timeoutValue = "30";
				if (builder.ContainsKey("connect timeout"))
					timeoutValue = (string) builder["connect timeout"];
				else if (builder.ContainsKey("connection timeout"))
					timeoutValue = (string) builder["connection timeout"];
				var v = Convert.ToInt32(timeoutValue);
				if (v > 0)
					this.CommandTimeout = v;
			}
			catch { }
			this.OnContextCreated();
		}

		#endregion

		partial void OnContextCreated();

		/// <summary>
		/// Model creation event
		/// </summary>
		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			base.OnModelCreating(modelBuilder);
			modelBuilder.Conventions.Remove<System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention>();
			Database.SetInitializer(new CustomDatabaseInitializer<AutosEntities>());

			#region Hierarchy Mapping
			modelBuilder.Entity<Dealer>().ToTable("Dealer");
			modelBuilder.Entity<UserAccount>().ToTable("UserAccount");
			#endregion

			#region Rename Tables
			#endregion

			#region Setup Fields

			//Field setup for Administrator entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.Active).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.AdministratorId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.Email).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.FirstName).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.LastIpAddress).IsRequired().HasMaxLength(15);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.LastName).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.Password).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().Property(d => d.UserName).IsRequired().HasMaxLength(50);

			//Field setup for BodyType entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BodyType>().Property(d => d.BodyTypeId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BodyType>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for BulletPoint entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>().Property(d => d.BulletPointId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>().Property(d => d.Text).IsRequired().HasMaxLength(500);

			//Field setup for City entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.City>().Property(d => d.CityId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.City>().Property(d => d.Name).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.City>().Property(d => d.StateId).IsRequired();

			//Field setup for Color entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Color>().Property(d => d.ColorId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Color>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for Condition entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Condition>().Property(d => d.ConditionId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Condition>().Property(d => d.Name).HasMaxLength(50);

			//Field setup for ConfigSetting entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ConfigSetting>().Property(d => d.ID).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ConfigSetting>().Property(d => d.Name).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ConfigSetting>().Property(d => d.Value).IsRequired().HasMaxLength(100);

			//Field setup for Dealer entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Dealer>().Property(d => d.CompanyName).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Dealer>().Property(d => d.Directions).HasMaxLength(500);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Dealer>().Property(d => d.MetroId);

			//Field setup for Feature entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Feature>().Property(d => d.FeatureId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Feature>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for FuelType entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.FuelType>().Property(d => d.FuelTypeId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.FuelType>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for Listing entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Active).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.BodyTypeId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ColorExtId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ColorIntId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ConditionId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Cylinders);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Description).HasMaxLength(1000);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Disclaimer).HasMaxLength(5000);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Doors);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Engine).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ExpirationDate).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.FuelTypeId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Invoice);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.IsFeatured);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ListDate);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.MakeModelId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.MetroId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Mileage).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Price).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.StockNumber).HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Title).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.TransmissionId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.TrimLevel).HasMaxLength(10);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.UserId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Vin).HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().Property(d => d.Year).IsRequired();

			//Field setup for ListingImage entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>().Property(d => d.FileName).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>().Property(d => d.ListingImageId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>().Property(d => d.SortOrder);

			//Field setup for ListingPremium entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.Active).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.CityName).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.ExpirationDate).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.ListingPremiumId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.StartDate).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().Property(d => d.StateId).IsRequired();

			//Field setup for ListingSaved entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>().Property(d => d.UserId).IsRequired();

			//Field setup for ListingView entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingView>().Property(d => d.ListingId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingView>().Property(d => d.ListingViewId).IsRequired();

			//Field setup for Make entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Make>().Property(d => d.MakeId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Make>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for MakeModel entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>().Property(d => d.MakeId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>().Property(d => d.MakeModelId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>().Property(d => d.ModelId).IsRequired();

			//Field setup for Metro entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Metro>().Property(d => d.IsPopular).IsRequired().HasMaxLength(1);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Metro>().Property(d => d.MetroId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Metro>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for Model entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Model>().Property(d => d.ModelId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Model>().Property(d => d.MpgCity);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Model>().Property(d => d.MpgHighway);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Model>().Property(d => d.Name).IsRequired().HasMaxLength(50);

			//Field setup for SearchSaved entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.Location).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.Name).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.Radius);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.SearchSavedId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.Text).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().Property(d => d.UserId).IsRequired();

			//Field setup for SearchSavedCriteria entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>().Property(d => d.Didx).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>().Property(d => d.Dvidx).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>().Property(d => d.SearchSavedCriteriaId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>().Property(d => d.SearchSavedId).IsRequired();

			//Field setup for State entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.State>().Property(d => d.Abbr).IsRequired().HasMaxLength(2);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.State>().Property(d => d.Description).IsRequired().HasMaxLength(4000);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.State>().Property(d => d.Name).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.State>().Property(d => d.StateId).IsRequired();

			//Field setup for Transmission entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Transmission>().Property(d => d.Name).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Transmission>().Property(d => d.TransmissionId).IsRequired();

			//Field setup for UserAccount entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.AcceptedAdvertTerms).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Active).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Address1).HasMaxLength(150);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Address2).HasMaxLength(150);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.AlertFrequency).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.AlertSent);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.City).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Description).HasMaxLength(1073741823);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Email).IsRequired().HasMaxLength(175);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.FirstName).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.HomePhone).HasMaxLength(20);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.LastName).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Latitude);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Longitude);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.MobilePhone).HasMaxLength(20);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.OfficeFax).HasMaxLength(20);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.OfficePhone).HasMaxLength(20);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.OfficePhoneExt).HasMaxLength(10);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.Password).IsRequired().HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.StateId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.UserId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.UserTypeId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().Property(d => d.ZipId);

			//Field setup for UserLoginHistory entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>().Property(d => d.BrowserAgent).HasMaxLength(255);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>().Property(d => d.IpAddress).IsRequired().HasMaxLength(15);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>().Property(d => d.UserId).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>().Property(d => d.UserLoginHistoryId).IsRequired();

			//Field setup for UserType entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserType>().Property(d => d.Active).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserType>().Property(d => d.Name).IsRequired().HasMaxLength(50);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserType>().Property(d => d.UserTypeId).IsRequired();

			//Field setup for VistorContact entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.Email).HasMaxLength(128);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.IpAddress).IsRequired().HasMaxLength(15);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.IsHandled).IsRequired();
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.Message).IsRequired().HasMaxLength(2147483647);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.Name).HasMaxLength(100);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.Phone).HasMaxLength(15);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.UserId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().Property(d => d.VisitorContactId).IsRequired();

			//Field setup for Zip entity
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().Property(d => d.Latitude);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().Property(d => d.Longitude);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().Property(d => d.Name).IsRequired().HasMaxLength(10);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().Property(d => d.StateId);
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().Property(d => d.ZipId).IsRequired();

			#endregion

			#region Ignore Enum Properties

			modelBuilder.Entity<UserAccount>().Ignore(t => t.UserTypeValue);
			modelBuilder.Entity<UserType>().Ignore(t => t.UserTypeValue);

			#endregion

			#region Relations

			//Relation BodyType -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasOptional(a => a.BodyType)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.BodyTypeId })
							 .WillCascadeOnDelete(false);

			//Relation Color -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasRequired(a => a.ExteriorColor)
							 .WithMany(b => b.ExteriorListingList)
							 .HasForeignKey(u => new { u.ColorExtId })
							 .WillCascadeOnDelete(false);

			//Relation Color -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasRequired(a => a.InteriorColor)
							 .WithMany(b => b.InteriorListingList)
							 .HasForeignKey(u => new { u.ColorIntId })
							 .WillCascadeOnDelete(false);

			//Relation Condition -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasOptional(a => a.Condition)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.ConditionId })
							 .WillCascadeOnDelete(false);

			//Relation FuelType -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasOptional(a => a.FuelType)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.FuelTypeId })
							 .WillCascadeOnDelete(false);

			//Relation Listing -> BulletPoint
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>()
							 .HasRequired(a => a.Listing)
							 .WithMany(b => b.BulletPointList)
							 .HasForeignKey(u => new { u.ListingId })
							 .WillCascadeOnDelete(false);

			//Relation Listing -> ListingView
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingView>()
							 .HasRequired(a => a.Listing)
							 .WithMany(b => b.ListingViewList)
							 .HasForeignKey(u => new { u.ListingId })
							 .WillCascadeOnDelete(false);

			//Relation Listing -> ListingImage
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>()
							 .HasRequired(a => a.Listing)
							 .WithMany(b => b.ListingImageList)
							 .HasForeignKey(u => new { u.ListingId })
							 .WillCascadeOnDelete(false);

			//Relation Listing -> ListingPremium
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>()
							 .HasRequired(a => a.Listing)
							 .WithMany(b => b.ListingPremiumList)
							 .HasForeignKey(u => new { u.ListingId })
							 .WillCascadeOnDelete(false);

			//Relation Listing -> ListingSaved
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>()
							 .HasRequired(a => a.Listing)
							 .WithMany(b => b.ListingSavedList)
							 .HasForeignKey(u => new { u.ListingId })
							 .WillCascadeOnDelete(false);

			//Relation Make -> MakeModel
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>()
							 .HasRequired(a => a.Make)
							 .WithMany(b => b.MakeModelList)
							 .HasForeignKey(u => new { u.MakeId })
							 .WillCascadeOnDelete(false);

			//Relation MakeModel -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasRequired(a => a.MakeModel)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.MakeModelId })
							 .WillCascadeOnDelete(false);

			//Relation Metro -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasOptional(a => a.Metro)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.MetroId })
							 .WillCascadeOnDelete(false);

			//Relation Metro -> Dealer
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Dealer>()
							 .HasOptional(a => a.Metro)
							 .WithMany(b => b.DealerList)
							 .HasForeignKey(u => new { u.MetroId })
							 .WillCascadeOnDelete(false);

			//Relation Model -> MakeModel
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>()
							 .HasRequired(a => a.Model)
							 .WithMany(b => b.MakeModelList)
							 .HasForeignKey(u => new { u.ModelId })
							 .WillCascadeOnDelete(false);

			//Relation SearchSaved -> SearchSavedCriteria
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>()
							 .HasRequired(a => a.SearchSaved)
							 .WithMany(b => b.SearchSavedCriteriaList)
							 .HasForeignKey(u => new { u.SearchSavedId })
							 .WillCascadeOnDelete(false);

			//Relation State -> City
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.City>()
							 .HasRequired(a => a.State)
							 .WithMany(b => b.CityList)
							 .HasForeignKey(u => new { u.StateId })
							 .WillCascadeOnDelete(false);

			//Relation State -> Zip
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>()
							 .HasOptional(a => a.State)
							 .WithMany(b => b.ZipList)
							 .HasForeignKey(u => new { u.StateId })
							 .WillCascadeOnDelete(false);

			//Relation State -> UserAccount
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>()
							 .HasRequired(a => a.State)
							 .WithMany(b => b.UserAccountList)
							 .HasForeignKey(u => new { u.StateId })
							 .WillCascadeOnDelete(false);

			//Relation Transmission -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasOptional(a => a.Transmission)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.TransmissionId })
							 .WillCascadeOnDelete(false);

			//Relation UserAccount -> UserLoginHistory
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>()
							 .HasRequired(a => a.UserAccount)
							 .WithMany(b => b.UserLoginHistoryList)
							 .HasForeignKey(u => new { u.UserId })
							 .WillCascadeOnDelete(false);

			//Relation UserAccount -> Listing
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>()
							 .HasRequired(a => a.UserAccount)
							 .WithMany(b => b.ListingList)
							 .HasForeignKey(u => new { u.UserId })
							 .WillCascadeOnDelete(false);

			//Relation UserAccount -> SearchSaved
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>()
							 .HasRequired(a => a.UserAccount)
							 .WithMany(b => b.SearchSavedList)
							 .HasForeignKey(u => new { u.UserId })
							 .WillCascadeOnDelete(false);

			//Relation UserAccount -> VistorContact
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>()
							 .HasOptional(a => a.UserAccount)
							 .WithMany(b => b.VistorContactList)
							 .HasForeignKey(u => new { u.UserId })
							 .WillCascadeOnDelete(false);

			//Relation UserAccount -> ListingSaved
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>()
							 .HasRequired(a => a.UserAccount)
							 .WithMany(b => b.ListingSavedList)
							 .HasForeignKey(u => new { u.UserId })
							 .WillCascadeOnDelete(false);

			//Relation UserType -> UserAccount
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>()
							 .HasRequired(a => a.UserType)
							 .WithMany(b => b.UserAccountList)
							 .HasForeignKey(u => new { u.UserTypeId })
							 .WillCascadeOnDelete(false);

			//Relation Zip -> UserAccount
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>()
							 .HasOptional(a => a.Zip)
							 .WithMany(b => b.UserAccountList)
							 .HasForeignKey(u => new { u.ZipId })
							 .WillCascadeOnDelete(false);

			modelBuilder.Entity<City>()
				.HasMany(q => q.ZipList)
				.WithMany(q => q.CityList)
				.Map(q =>
			{
				q.ToTable("CityZip");
				q.MapLeftKey("CityId");
				q.MapRightKey("ZipId");
			});

			modelBuilder.Entity<Feature>()
				.HasMany(q => q.ListingList)
				.WithMany(q => q.FeatureList)
				.Map(q =>
			{
				q.ToTable("ListingFeature");
				q.MapLeftKey("FeatureId");
				q.MapRightKey("ListingId");
			});

			modelBuilder.Entity<Metro>()
				.HasMany(q => q.StateList)
				.WithMany(q => q.MetroList)
				.Map(q =>
			{
				q.ToTable("MetroState");
				q.MapLeftKey("MetroId");
				q.MapRightKey("StateId");
			});

			modelBuilder.Entity<Metro>()
				.HasMany(q => q.ZipList)
				.WithMany(q => q.MetroList)
				.Map(q =>
			{
				q.ToTable("MetroZip");
				q.MapLeftKey("MetroId");
				q.MapRightKey("ZipId");
			});

			#endregion

			#region Primary Keys

			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Administrator>().HasKey(x => new { x.AdministratorId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BodyType>().HasKey(x => new { x.BodyTypeId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>().HasKey(x => new { x.BulletPointId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.City>().HasKey(x => new { x.CityId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Color>().HasKey(x => new { x.ColorId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Condition>().HasKey(x => new { x.ConditionId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ConfigSetting>().HasKey(x => new { x.ID });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Dealer>().HasKey(x => new { x.UserId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Feature>().HasKey(x => new { x.FeatureId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.FuelType>().HasKey(x => new { x.FuelTypeId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Listing>().HasKey(x => new { x.ListingId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingImage>().HasKey(x => new { x.ListingImageId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>().HasKey(x => new { x.ListingPremiumId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>().HasKey(x => new { x.ListingId, x.UserId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.ListingView>().HasKey(x => new { x.ListingViewId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Make>().HasKey(x => new { x.MakeId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.MakeModel>().HasKey(x => new { x.MakeModelId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Metro>().HasKey(x => new { x.MetroId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Model>().HasKey(x => new { x.ModelId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSaved>().HasKey(x => new { x.SearchSavedId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria>().HasKey(x => new { x.SearchSavedCriteriaId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.State>().HasKey(x => new { x.StateId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Transmission>().HasKey(x => new { x.TransmissionId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserAccount>().HasKey(x => new { x.UserId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory>().HasKey(x => new { x.UserLoginHistoryId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.UserType>().HasKey(x => new { x.UserTypeId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.VistorContact>().HasKey(x => new { x.VisitorContactId });
			modelBuilder.Entity<Widgetsphere.Autos.EFDAL.Entity.Zip>().HasKey(x => new { x.ZipId });
			#endregion

		}

		/// <summary>
		/// Persists all updates to the data source and resets change tracking in the object context.
		/// </summary>
		/// <returns>The number of objects in an System.Data.Entity.EntityState.Added, System.Data.Entity.EntityState.Modified, or System.Data.Entity.EntityState.Deleted state when System.Data.Objects.ObjectContext.SaveChanges() was called.</returns>
		public override int SaveChanges()
		{
			//Process deleted list
			var deletedList = this.ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.Entity.EntityState.Deleted);
			foreach (var item in deletedList)
			{
				var entity = item.Entity as nHydrate.EFCore.DataAccess.IAuditable;
				if (entity != null)
				{
					if (entity.IsModifyAuditImplemented && entity.ModifiedBy != this.ContextStartup.Modifer)
					{
						System.Data.SqlClient.SqlConnection connection = null;
						try
						{
							connection = new System.Data.SqlClient.SqlConnection(GetConnectionString());
							connection.Open();
							System.Data.SqlClient.SqlCommand command = null;
							if (command != null)
							{
								command.CommandType = System.Data.CommandType.Text;
								if (this.ContextStartup.Modifer == null)
									command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@mod", System.DBNull.Value));
								else
									command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@mod", this.ContextStartup.Modifer));
								command.ExecuteNonQuery();
							}
						}
						catch
						{
							throw;
						}
						finally
						{
							if (connection != null && connection.State == System.Data.ConnectionState.Open)
								connection.Close();
						}
					}
				}
			}

			var markedTime = System.DateTime.Now;
			//Process added list
			var addedList = this.ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.Entity.EntityState.Added);
			foreach (var item in addedList)
			{
				var entity = item.Entity as nHydrate.EFCore.DataAccess.IAuditable;
				if (entity != null)
				{
					if (entity.IsModifyAuditImplemented && entity.ModifiedBy != this.ContextStartup.Modifer)
					{
						if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingView) ((Widgetsphere.Autos.EFDAL.Entity.ListingView)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory) ((Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ResetCreatedBy(this.ContextStartup.Modifer);
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ResetCreatedBy(this.ContextStartup.Modifer);
					}
					if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingView) ((Widgetsphere.Autos.EFDAL.Entity.ListingView)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory) ((Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).CreatedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).CreatedDate = markedTime;
					if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ModifiedDate = markedTime;

					if (this.CurrentPlatform == DatabasePlatformConstants.MySql)
					{
						if (entity.IsTimestampAuditImplemented)
						{
							if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
						}
					}

				}
			}

			//Process modified list
			var modifiedList = this.ObjectContext.ObjectStateManager.GetObjectStateEntries(System.Data.Entity.EntityState.Modified);
			foreach (var item in modifiedList)
			{
				var entity = item.Entity as nHydrate.EFCore.DataAccess.IAuditable;
				if (entity != null)
				{
					if (entity.IsModifyAuditImplemented && entity.ModifiedBy != this.ContextStartup.Modifer)
					{
						if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ModifiedBy = this.ContextStartup.Modifer;
						else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ModifiedBy = this.ContextStartup.Modifer;
					}

					if (this.CurrentPlatform == DatabasePlatformConstants.MySql)
					{
						if (entity.IsTimestampAuditImplemented)
						{
							if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
							else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).TimeStamp = new byte[] { (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256), (byte)_rnd.Next(0, 256) };
						}
					}

					if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator) ((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType) ((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint) ((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.City) ((Widgetsphere.Autos.EFDAL.Entity.City)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Color) ((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Condition) ((Widgetsphere.Autos.EFDAL.Entity.Condition)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting) ((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer) ((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature) ((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType) ((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing) ((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage) ((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium) ((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved) ((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Make) ((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel) ((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro) ((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Model) ((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved) ((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria) ((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.State) ((Widgetsphere.Autos.EFDAL.Entity.State)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission) ((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount) ((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact) ((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ModifiedDate = markedTime;
					else if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip) ((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ModifiedDate = markedTime;
				}
			}

			return base.SaveChanges();
		}
		private Random _rnd = new Random();

		#region Entity Sets

		/// <summary>
		/// Entity set for Administrator
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Administrator> Administrator { get; set; }

		/// <summary>
		/// Entity set for BodyType
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.BodyType> BodyType { get; set; }

		/// <summary>
		/// Entity set for BulletPoint
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.BulletPoint> BulletPoint { get; set; }

		/// <summary>
		/// Entity set for City
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.City> City { get; set; }

		/// <summary>
		/// Entity set for Color
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Color> Color { get; set; }

		/// <summary>
		/// Entity set for Condition
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Condition> Condition { get; set; }

		/// <summary>
		/// Entity set for ConfigSetting
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.ConfigSetting> ConfigSetting { get; set; }

		/// <summary>
		/// Entity set for Dealer
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Dealer> Dealer { get; set; }

		/// <summary>
		/// Entity set for Feature
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Feature> Feature { get; set; }

		/// <summary>
		/// Entity set for FuelType
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.FuelType> FuelType { get; set; }

		/// <summary>
		/// Entity set for Listing
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Listing> Listing { get; set; }

		/// <summary>
		/// Entity set for ListingImage
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.ListingImage> ListingImage { get; set; }

		/// <summary>
		/// Entity set for ListingPremium
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.ListingPremium> ListingPremium { get; set; }

		/// <summary>
		/// Entity set for ListingSaved
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.ListingSaved> ListingSaved { get; set; }

		/// <summary>
		/// Entity set for ListingView
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.ListingView> ListingView { get; set; }

		/// <summary>
		/// Entity set for Make
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Make> Make { get; set; }

		/// <summary>
		/// Entity set for MakeModel
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.MakeModel> MakeModel { get; set; }

		/// <summary>
		/// Entity set for Metro
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Metro> Metro { get; set; }

		/// <summary>
		/// Entity set for Model
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Model> Model { get; set; }

		/// <summary>
		/// Entity set for SearchSaved
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.SearchSaved> SearchSaved { get; set; }

		/// <summary>
		/// Entity set for SearchSavedCriteria
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria> SearchSavedCriteria { get; set; }

		/// <summary>
		/// Entity set for State
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.State> State { get; set; }

		/// <summary>
		/// Entity set for Transmission
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Transmission> Transmission { get; set; }

		/// <summary>
		/// Entity set for UserAccount
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.UserAccount> UserAccount { get; set; }

		/// <summary>
		/// Entity set for UserLoginHistory
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory> UserLoginHistory { get; set; }

		/// <summary>
		/// Entity set for UserType
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.UserType> UserType { get; set; }

		/// <summary>
		/// Entity set for VistorContact
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.VistorContact> VistorContact { get; set; }

		/// <summary>
		/// Entity set for Zip
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Zip> Zip { get; set; }

		/// <summary>
		/// Entity set for Listingdisplayview
		/// </summary>
		public DbSet<Widgetsphere.Autos.EFDAL.Entity.Listingdisplayview> Listingdisplayview { get; set; }

		#endregion

		/// <summary>
		/// The global settings of this context
		/// </summary>
		public virtual ContextStartup ContextStartup
		{
			get { return _contextStartup; }
		}

		/// <summary />
		public virtual System.Data.Entity.Core.Objects.ObjectContextOptions ContextOptions
		{
			get { return this.ObjectContext.ContextOptions; }
		}

		/// <summary>
		/// Determines the version of the model that created this library.
		/// </summary>
		public virtual string Version
		{
			get { return "1.0.0.0.13"; }
		}

		/// <summary>
		/// Determines the key of the model that created this library.
		/// </summary>
		public virtual string ModelKey
		{
			get { return "cf971690-d36f-4e66-a8e4-8199c3fa6bb8"; }
		}

		/// <summary>
		/// Determines if the API matches the database connection
		/// </summary>
		public virtual bool IsValidConnection()
		{
			return IsValidConnection(GetConnectionString(), true);
		}

		/// <summary>
		/// Determines if the API matches the database connection
		/// </summary>
		public virtual bool IsValidConnection(bool checkVersion)
		{
			return IsValidConnection(GetConnectionString(), checkVersion);
		}

		/// <summary>
		/// Determines if the API matches the database connection
		/// </summary>
		/// <param name="checkVersion">Determines if the check also includes the exact version of the model</param>
		/// <param name="connectionString">Determines the connection string to use when connecting to the database</param>
		/// <returns></returns>
		public virtual bool IsValidConnection(string connectionString, bool checkVersion = true)
		{
			if (string.IsNullOrEmpty(connectionString))
				return false;

			//Get current version
			var version = GetDBVersion(connectionString);

			//If there is any version then the ModelKey was found, if not found then the database does not contain this model
			if (string.IsNullOrEmpty(version))
				return false;

			if (checkVersion)
			{
				if (version != this.Version)
					return false;
			}

			return true;
		}

		/// <summary>
		/// Retrieves the latest database version for the current model
		/// </summary>
		public string GetDBVersion(string connectionString)
		{
			var conn = new System.Data.SqlClient.SqlConnection();
			try
			{
				conn.ConnectionString = connectionString;
				conn.Open();

				var da = new SqlDataAdapter("select * from sys.tables where name = '__nhydrateschema'", conn);
				var ds = new DataSet();
				da.Fill(ds);
				if (ds.Tables[0].Rows.Count > 0)
				{
					da = new SqlDataAdapter("SELECT * FROM __nhydrateschema where [ModelKey] = '" + this.ModelKey + "'", conn);
					ds = new DataSet();
					da.Fill(ds);
					var t = ds.Tables[0];
					if (t.Rows.Count > 0)
					{
						return (string) t.Rows[0]["dbVersion"];
					}
				}
				return string.Empty;
			}
			catch (Exception)
			{
				throw;
			}
			finally
			{
				if (conn != null)
					conn.Close();
			}
		}

		/// <summary>
		/// Determines the supported database platforms
		/// </summary>
		public DatabasePlatformConstants CurrentPlatform { get; private set; }

		#region AddItem Methods

		/// <summary>
		/// Adds an entity of type 'Administrator' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IAdministrator entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Administrator.Add((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity);
		}

		/// <summary>
		/// Adds an entity of type 'BodyType' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBodyType entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType)
			{
				((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.BodyType.Add((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity);
		}

		/// <summary>
		/// Adds an entity of type 'BulletPoint' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint)
			{
				((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.BulletPoint.Add((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity);
		}

		/// <summary>
		/// Adds an entity of type 'City' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICity entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.City)
			{
				((Widgetsphere.Autos.EFDAL.Entity.City)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.City)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.City.Add((Widgetsphere.Autos.EFDAL.Entity.City)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Color' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Color)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Color)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Color.Add((Widgetsphere.Autos.EFDAL.Entity.Color)entity);
		}

		/// <summary>
		/// Adds an entity of type 'ConfigSetting' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IConfigSetting entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.ConfigSetting.Add((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Dealer' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Dealer.Add((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Feature' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Feature.Add((Widgetsphere.Autos.EFDAL.Entity.Feature)entity);
		}

		/// <summary>
		/// Adds an entity of type 'FuelType' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFuelType entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType)
			{
				((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.FuelType.Add((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Listing' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Listing.Add((Widgetsphere.Autos.EFDAL.Entity.Listing)entity);
		}

		/// <summary>
		/// Adds an entity of type 'ListingImage' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.ListingImage.Add((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity);
		}

		/// <summary>
		/// Adds an entity of type 'ListingPremium' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.ListingPremium.Add((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity);
		}

		/// <summary>
		/// Adds an entity of type 'ListingSaved' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.ListingSaved.Add((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity);
		}

		/// <summary>
		/// Adds an entity of type 'ListingView' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingView)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingView)entity).CreatedBy = _contextStartup.Modifer;
			}
			this.ListingView.Add((Widgetsphere.Autos.EFDAL.Entity.ListingView)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Make' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMake entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Make)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Make)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Make.Add((Widgetsphere.Autos.EFDAL.Entity.Make)entity);
		}

		/// <summary>
		/// Adds an entity of type 'MakeModel' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMakeModel entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel)
			{
				((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.MakeModel.Add((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Metro' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Metro.Add((Widgetsphere.Autos.EFDAL.Entity.Metro)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Model' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IModel entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Model)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Model)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Model.Add((Widgetsphere.Autos.EFDAL.Entity.Model)entity);
		}

		/// <summary>
		/// Adds an entity of type 'SearchSaved' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSaved entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved)
			{
				((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.SearchSaved.Add((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity);
		}

		/// <summary>
		/// Adds an entity of type 'SearchSavedCriteria' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSavedCriteria entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)
			{
				((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.SearchSavedCriteria.Add((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity);
		}

		/// <summary>
		/// Adds an entity of type 'State' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IState entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.State)
			{
				((Widgetsphere.Autos.EFDAL.Entity.State)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.State)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.State.Add((Widgetsphere.Autos.EFDAL.Entity.State)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Transmission' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ITransmission entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Transmission.Add((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity);
		}

		/// <summary>
		/// Adds an entity of type 'UserAccount' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserAccount entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount)
			{
				((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.UserAccount.Add((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity);
		}

		/// <summary>
		/// Adds an entity of type 'UserLoginHistory' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserLoginHistory entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)
			{
				((Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)entity).CreatedBy = _contextStartup.Modifer;
			}
			this.UserLoginHistory.Add((Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)entity);
		}

		/// <summary>
		/// Adds an entity of type 'VistorContact' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IVistorContact entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact)
			{
				((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.VistorContact.Add((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Zip' to the object context
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IZip entity)
		{
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.Zip.Add((Widgetsphere.Autos.EFDAL.Entity.Zip)entity);
		}

		/// <summary>
		/// Adds an entity of type 'Listingdisplayview' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Widgetsphere.Autos.EFDAL.Entity.Listingdisplayview entity)
		{
			this.Listingdisplayview.Add(entity);
		}

		#endregion

		#region DeleteItem Methods

		/// <summary>
		/// Deletes an entity of type 'Administrator'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Administrator entity)
		{
			if (entity == null) return;
			this.Administrator.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Administrator'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IAdministrator entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Administrator)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Administrator)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Administrator);
		}

		/// <summary>
		/// Deletes an entity of type 'BodyType'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.BodyType entity)
		{
			if (entity == null) return;
			this.BodyType.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'BodyType'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBodyType entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.BodyType)
			{
				((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.BodyType)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.BodyType);
		}

		/// <summary>
		/// Deletes an entity of type 'BulletPoint'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.BulletPoint entity)
		{
			if (entity == null) return;
			this.BulletPoint.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'BulletPoint'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.BulletPoint)
			{
				((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.BulletPoint)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.BulletPoint);
		}

		/// <summary>
		/// Deletes an entity of type 'City'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.City entity)
		{
			if (entity == null) return;
			this.City.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'City'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICity entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.City)
			{
				((Widgetsphere.Autos.EFDAL.Entity.City)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.City)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.City);
		}

		/// <summary>
		/// Deletes an entity of type 'Color'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Color entity)
		{
			if (entity == null) return;
			this.Color.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Color'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Color)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Color)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Color)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Color);
		}

		/// <summary>
		/// Deletes an entity of type 'ConfigSetting'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.ConfigSetting entity)
		{
			if (entity == null) return;
			this.ConfigSetting.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'ConfigSetting'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IConfigSetting entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ConfigSetting)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.ConfigSetting);
		}

		/// <summary>
		/// Deletes an entity of type 'Dealer'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Dealer entity)
		{
			if (entity == null) return;
			this.UserAccount.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Dealer'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Dealer)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Dealer)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Dealer);
		}

		/// <summary>
		/// Deletes an entity of type 'Feature'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Feature entity)
		{
			if (entity == null) return;
			this.Feature.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Feature'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Feature)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Feature)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Feature);
		}

		/// <summary>
		/// Deletes an entity of type 'FuelType'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.FuelType entity)
		{
			if (entity == null) return;
			this.FuelType.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'FuelType'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFuelType entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.FuelType)
			{
				((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.FuelType)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.FuelType);
		}

		/// <summary>
		/// Deletes an entity of type 'Listing'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Listing entity)
		{
			if (entity == null) return;
			this.Listing.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Listing'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Listing)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Listing)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Listing);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingImage'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.ListingImage entity)
		{
			if (entity == null) return;
			this.ListingImage.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingImage'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingImage)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingImage)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.ListingImage);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingPremium'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.ListingPremium entity)
		{
			if (entity == null) return;
			this.ListingPremium.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingPremium'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingPremium)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingPremium)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.ListingPremium);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingSaved'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.ListingSaved entity)
		{
			if (entity == null) return;
			this.ListingSaved.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingSaved'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingSaved)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.ListingSaved)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.ListingSaved);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingView'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.ListingView entity)
		{
			if (entity == null) return;
			this.ListingView.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'ListingView'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.ListingView)
			{
				((Widgetsphere.Autos.EFDAL.Entity.ListingView)entity).CreatedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.ListingView);
		}

		/// <summary>
		/// Deletes an entity of type 'Make'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Make entity)
		{
			if (entity == null) return;
			this.Make.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Make'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMake entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Make)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Make)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Make)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Make);
		}

		/// <summary>
		/// Deletes an entity of type 'MakeModel'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.MakeModel entity)
		{
			if (entity == null) return;
			this.MakeModel.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'MakeModel'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMakeModel entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.MakeModel)
			{
				((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.MakeModel)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.MakeModel);
		}

		/// <summary>
		/// Deletes an entity of type 'Metro'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Metro entity)
		{
			if (entity == null) return;
			this.Metro.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Metro'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Metro)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Metro)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Metro);
		}

		/// <summary>
		/// Deletes an entity of type 'Model'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Model entity)
		{
			if (entity == null) return;
			this.Model.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Model'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IModel entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Model)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Model)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Model)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Model);
		}

		/// <summary>
		/// Deletes an entity of type 'SearchSaved'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.SearchSaved entity)
		{
			if (entity == null) return;
			this.SearchSaved.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'SearchSaved'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSaved entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSaved)
			{
				((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.SearchSaved)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.SearchSaved);
		}

		/// <summary>
		/// Deletes an entity of type 'SearchSavedCriteria'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria entity)
		{
			if (entity == null) return;
			this.SearchSavedCriteria.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'SearchSavedCriteria'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSavedCriteria entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)
			{
				((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria);
		}

		/// <summary>
		/// Deletes an entity of type 'State'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.State entity)
		{
			if (entity == null) return;
			this.State.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'State'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IState entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.State)
			{
				((Widgetsphere.Autos.EFDAL.Entity.State)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.State)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.State);
		}

		/// <summary>
		/// Deletes an entity of type 'Transmission'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Transmission entity)
		{
			if (entity == null) return;
			this.Transmission.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Transmission'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.ITransmission entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Transmission)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Transmission)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Transmission);
		}

		/// <summary>
		/// Deletes an entity of type 'UserAccount'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.UserAccount entity)
		{
			if (entity == null) return;
			this.UserAccount.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'UserAccount'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserAccount entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.UserAccount)
			{
				((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.UserAccount)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.UserAccount);
		}

		/// <summary>
		/// Deletes an entity of type 'UserLoginHistory'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory entity)
		{
			if (entity == null) return;
			this.UserLoginHistory.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'UserLoginHistory'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserLoginHistory entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)
			{
				((Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory)entity).CreatedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory);
		}

		/// <summary>
		/// Deletes an entity of type 'VistorContact'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.VistorContact entity)
		{
			if (entity == null) return;
			this.VistorContact.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'VistorContact'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IVistorContact entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.VistorContact)
			{
				((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.VistorContact)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.VistorContact);
		}

		/// <summary>
		/// Deletes an entity of type 'Zip'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		public virtual void DeleteItem(Widgetsphere.Autos.EFDAL.Entity.Zip entity)
		{
			if (entity == null) return;
			this.Zip.Remove(entity);
		}

		/// <summary>
		/// Deletes an entity of type 'Zip'
		/// </summary>
		/// <param name="entity">The entity to delete</param>
		void Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.DeleteItem(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IZip entity)
		{
			if (entity == null) return;
			if (entity is Widgetsphere.Autos.EFDAL.Entity.Zip)
			{
				((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).CreatedBy = _contextStartup.Modifer;
				((Widgetsphere.Autos.EFDAL.Entity.Zip)entity).ModifiedBy = _contextStartup.Modifer;
			}
			this.DeleteItem(entity as Widgetsphere.Autos.EFDAL.Entity.Zip);
		}

		#endregion

		/// <summary>
		/// Returns the connection string used for this context object
		/// </summary>
		public string ConnectionString
		{
			get
			{
				try
				{
					if (this.Database.Connection != null && !string.IsNullOrEmpty(this.Database.Connection.ConnectionString))
					{
						return Util.StripEFCS2Normal(this.Database.Connection.ConnectionString);
					}
					else
					{
						return null;
					}

				}
				catch (Exception)
				{
					return null;
				}
			}
		}
		/// <summary>
		/// Returns the globally configured connection string for this context type
		/// </summary>
		public static string GetConnectionString()
		{
			try
			{
				var a = System.Configuration.ConfigurationManager.ConnectionStrings["AutosEntities"];
				if (a != null)
				{
					var s = a.ConnectionString;
					var regEx = new System.Text.RegularExpressions.Regex("provider connection string\\s*=\\s*\"([^\"]*)");
					var m = regEx.Match(s);
					var connString = s;
					if (m != null && m.Groups.Count > 1)
					{
						connString = m.Groups[1].Value;
					}
					return connString;
				}
				else
				{
					throw new Exception("The connection string was not found.");
				}
			}
			catch (Exception)
			{
				throw new Exception("The connection string was not found.");
			}
		}

		#region IAutos Members

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IAdministrator> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Administrator
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IAdministrator>)this.Administrator; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBodyType> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.BodyType
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBodyType>)this.BodyType; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.BulletPoint
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint>)this.BulletPoint; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICity> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.City
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICity>)this.City; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Color
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor>)this.Color; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICondition> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Condition
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICondition>)this.Condition; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IConfigSetting> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.ConfigSetting
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IConfigSetting>)this.ConfigSetting; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Dealer
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer>)this.Dealer; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Feature
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature>)this.Feature; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFuelType> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.FuelType
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFuelType>)this.FuelType; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Listing
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing>)this.Listing; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.ListingImage
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage>)this.ListingImage; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.ListingPremium
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium>)this.ListingPremium; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.ListingSaved
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved>)this.ListingSaved; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.ListingView
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView>)this.ListingView; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMake> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Make
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMake>)this.Make; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMakeModel> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.MakeModel
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMakeModel>)this.MakeModel; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Metro
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro>)this.Metro; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IModel> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Model
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IModel>)this.Model; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSaved> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.SearchSaved
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSaved>)this.SearchSaved; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSavedCriteria> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.SearchSavedCriteria
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ISearchSavedCriteria>)this.SearchSavedCriteria; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IState> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.State
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IState>)this.State; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ITransmission> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Transmission
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.ITransmission>)this.Transmission; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserAccount> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.UserAccount
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserAccount>)this.UserAccount; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserLoginHistory> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.UserLoginHistory
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserLoginHistory>)this.UserLoginHistory; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserType> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.UserType
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserType>)this.UserType; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IVistorContact> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.VistorContact
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IVistorContact>)this.VistorContact; }
		}

		System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IZip> Widgetsphere.Autos.EFDAL.Interfaces.IAutosEntities.Zip
		{
			get { return (System.Data.Objects.IObjectSet<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IZip>)this.Zip; }
		}

		#endregion

		#region IContext Interface

		Enum nHydrate.EFCore.DataAccess.IContext.GetEntityFromField(Enum field)
		{
			return GetEntityFromField(field);
		}

		object nHydrate.EFCore.DataAccess.IContext.GetMetaData(Enum entity)
		{
			return GetMetaData((EntityMappingConstants)entity);
		}

		System.Type nHydrate.EFCore.DataAccess.IContext.GetFieldType(Enum field)
		{
			return this.GetFieldType(field);
		}

		#endregion

		#region GetEntityFromField

		/// <summary>
		/// Determines the entity from one of its fields
		/// </summary>
		public static EntityMappingConstants GetEntityFromField(Enum field)
		{
			if (field is Widgetsphere.Autos.EFDAL.Entity.Administrator.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Administrator;
			if (field is Widgetsphere.Autos.EFDAL.Entity.BodyType.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.BodyType;
			if (field is Widgetsphere.Autos.EFDAL.Entity.BulletPoint.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.BulletPoint;
			if (field is Widgetsphere.Autos.EFDAL.Entity.City.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.City;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Color.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Color;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Condition.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Condition;
			if (field is Widgetsphere.Autos.EFDAL.Entity.ConfigSetting.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.ConfigSetting;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Dealer.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Dealer;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Feature.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Feature;
			if (field is Widgetsphere.Autos.EFDAL.Entity.FuelType.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.FuelType;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Listing.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Listing;
			if (field is Widgetsphere.Autos.EFDAL.Entity.ListingImage.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingImage;
			if (field is Widgetsphere.Autos.EFDAL.Entity.ListingPremium.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingPremium;
			if (field is Widgetsphere.Autos.EFDAL.Entity.ListingSaved.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingSaved;
			if (field is Widgetsphere.Autos.EFDAL.Entity.ListingView.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingView;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Make.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Make;
			if (field is Widgetsphere.Autos.EFDAL.Entity.MakeModel.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.MakeModel;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Metro.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Metro;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Model.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Model;
			if (field is Widgetsphere.Autos.EFDAL.Entity.SearchSaved.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.SearchSaved;
			if (field is Widgetsphere.Autos.EFDAL.Entity.SearchSavedCriteria.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.SearchSavedCriteria;
			if (field is Widgetsphere.Autos.EFDAL.Entity.State.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.State;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Transmission.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Transmission;
			if (field is Widgetsphere.Autos.EFDAL.Entity.UserAccount.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserAccount;
			if (field is Widgetsphere.Autos.EFDAL.Entity.UserLoginHistory.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserLoginHistory;
			if (field is Widgetsphere.Autos.EFDAL.Entity.UserType.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserType;
			if (field is Widgetsphere.Autos.EFDAL.Entity.VistorContact.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.VistorContact;
			if (field is Widgetsphere.Autos.EFDAL.Entity.Zip.FieldNameConstants) return Widgetsphere.Autos.EFDAL.EntityMappingConstants.Zip;
			throw new Exception("Unknown field type!");
		}

		#endregion

		#region GetMetaData

		/// <summary>
		/// Gets the meta data object for an entity
		/// </summary>
		public static Widgetsphere.Autos.EFDAL.Interfaces.IMetadata GetMetaData(Widgetsphere.Autos.EFDAL.EntityMappingConstants table)
		{
			switch (table)
			{
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Administrator: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.AdministratorMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.BodyType: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.BodyTypeMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.BulletPoint: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.BulletPointMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.City: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.CityMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Color: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ColorMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Condition: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ConditionMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.ConfigSetting: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ConfigSettingMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Dealer: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.DealerMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Feature: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.FeatureMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.FuelType: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.FuelTypeMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Listing: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingImage: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingImageMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingPremium: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingPremiumMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingSaved: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingSavedMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.ListingView: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingViewMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Make: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.MakeMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.MakeModel: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.MakeModelMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Metro: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.MetroMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Model: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ModelMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.SearchSaved: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.SearchSavedMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.SearchSavedCriteria: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.SearchSavedCriteriaMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.State: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.StateMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Transmission: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.TransmissionMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserAccount: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.UserAccountMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserLoginHistory: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.UserLoginHistoryMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.UserType: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.UserTypeMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.VistorContact: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.VistorContactMetadata();
				case Widgetsphere.Autos.EFDAL.EntityMappingConstants.Zip: return new Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ZipMetadata();
			}
			throw new Exception("Entity not found!");
		}

		#endregion

		#region ObjectContext

		/// <summary />
		public System.Data.Entity.Core.Objects.ObjectContext ObjectContext
		{
			get { return ((System.Data.Entity.Infrastructure.IObjectContextAdapter)this).ObjectContext; }
		}

		/// <summary />
		public void AcceptAllChanges()
		{
			this.ObjectContext.AcceptAllChanges();
		}

		/// <summary />
		public int? CommandTimeout
		{
			get { return this.ObjectContext.CommandTimeout; }
			set { this.ObjectContext.CommandTimeout = value; }
		}

		#endregion

	#endregion

	}

	internal class CustomDatabaseInitializer<TContext> : IDatabaseInitializer<TContext> where TContext : global::System.Data.Entity.DbContext
	{
		public void InitializeDatabase(TContext context)
		{
		}
	}

}

namespace Widgetsphere.Autos.EFDAL.Entity
{
}

